﻿using System.Windows;
using MessageBox = HandyControl.Controls.MessageBox;

namespace ChatClient.Views
{
    /// <summary>
    /// RegisterWindow.xaml 的交互逻辑
    /// </summary>
    public partial class RegisterWindow : Window
    {
        //private readonly RegisterWindowViewModel _viewModel;

        public RegisterWindow()
        {
            InitializeComponent();

            //if (!DesignerProperties.GetIsInDesignMode(this))
            //{
            //    _viewModel = new RegisterWindowViewModel();
            //    _viewModel.CloseEvent += Close;
            //    _viewModel.RegisterEvent += OnRegister;
            //    DataContext = _viewModel;
            //}
        }

        private void OnRegister()
        {
            if (string.IsNullOrWhiteSpace(PasswordBox.Password))
            {
                MessageBox.Warning("请输入密码", "提示");
                return;
            }

            if (string.IsNullOrWhiteSpace(PasswordBoxConfirm.Password))
            {
                MessageBox.Warning("请输入密码", "提示");
                return;
            }

            if (!PasswordBox.Password.Equals(PasswordBoxConfirm.Password))
            {
                MessageBox.Warning("两次输入密码不一致", "提示");
                return;
            }

            //_viewModel?.DoRegister(PasswordBox.Password);
        }
    }
}
